<?php

class stabilityLayerController extends controllerBase {
	protected $mode = AETHER_BOTH;
	protected $view = true;
	protected $helpers = array();
	protected $models = array();
	protected $beforeFilters = array();
	protected $beforeAfter = array();
	
	function undo() {
		$layerName = $this->getParam('id');
		$this->m->load($layerName);
		$layer = &$this->m->$layerName;
		$layer->startRevision();
		$this->m->setStabilityHandler(&$layer);
		$layer->undo($_GET['revision'], $_GET['key']);
		$flash = 'Action undone.  <a href="stability-layer/undo/'.$layerName.'/?revision='.$layer->getRevision().'&key='.$layer->getKey().'&redirect=[pageUrl]';
		if(isset($_GET['redo'])) {
			$flash .= '">Undo</a>';
		} else {
			$flash .= '&redo">Redo</a>';
		}
		$this->h->message->add($flash);
		$this->h->core->redirect($_GET['redirect']);
	}
}

?>
